<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <!-- header -->
    <%@ include file="/WEB-INF/views/include/header.jsp" %>
</head>
<body class="no-skin">
<%--上传成功模态框--%>
<div class="shade" style="display: none;"></div>
<div class="warning" style="display: none;">
    <p class="title"><em></em><span class="close">X</span></p>
    <p class="cont"></p>
    <div class="la-square-jelly-box la-3x">
        <div></div>
        <div></div>
    </div>
</div>
<div class="modal fade" id="UrgeModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"
     data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title" id="myModalLabel">催办</h4> </div>
            <div class="modal-body ">
                <div class="information">
                    <div class="form-group clearfix">
                        <label class="control-label col-sm-2 text-right">姓名</label>
                        <div class="col-sm-9">
                            <input type="text" class="Modelname form-control" readonly >
                        </div>
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label col-sm-2 text-right">电话</label>
                        <div class="col-sm-9">
                            <input type="text" class="Modelphone form-control" readonly >
                        </div>
                    </div>
                </div>
                <div class="form-group clearfix">
                    <label class="control-label col-sm-2 text-right">常用语句</label>
                    <div class="col-sm-9">
                        <select class="form-control">
                            <option value="">点击选择</option>
                            <option>速度办理</option>
                            <option>及时办理</option>
                        </select>
                    </div>
                </div>
                <div class="form-group clearfix">
                    <label class="control-label col-sm-2 text-right">催办内容</label>
                    <div class="col-sm-9">
                        <textarea rows="3" class="form-control"></textarea>
                    </div>
                </div>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-success UrgeSure" data-dismiss="modal">确定</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">

    <!-- /section:basics/sidebar -->
    <div class="main-content">
        <div class="main-content-inner">
            <div class="page-content">
                <!-- /section:settings.box -->
                <div id="taskMainId" style="display: none">
                    ${taskMainId}
                </div>
                <div class="form-group">
                    <h3 class="text-left">
                        任务名称:${taskMain.mainName}
                    </h3>
                </div>
                <c:if test="${! empty taskMain.fileNumber}">
                    <div class="form-group">
                        <h3 class="text-left">
                            文号:${taskMain.fileNumber}
                        </h3>
                    </div>
                </c:if>
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <!-- jqGrid表格 -->
                        <table id="gridTable"></table>
                        <!-- jqGrid工具类 -->
                        <div id="gridPager"></div>
                        <!-- 查询对话框 -->
                        <div style="display: none;">
                            <div class="row" id="queryDialog"></div>
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
                <h4 class="redTips">温馨提示：双击表格行或者点击"查看" 查看任务详情</h4>
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->

    <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
        <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
    </a>

    <%@ include file="/WEB-INF/views/include/dialog.jsp" %>
</div><!-- /.main-container -->
</div>

<!-- footer -->
<%@ include file="/WEB-INF/views/include/footer.jsp" %>

<script type="text/javascript">
    // 基本路径
    var baseUrl = "<s:url value="/taskMain/showHasten/"></s:url>"

    // jqgrid的表格高度
    var height = 320;
    // jqgrid表格行头的中文
    var colNames = ['','任务名','子事项',"催办内容", "催办对象","时间","状态"];

    var colModel = [
        {name: 'sysId', width: 60, hidden: true, key: true},
        {name: 'taskMainName', index: 'taskMainName', width: 250, editable: true},
        {name: 'taskSubName', index: 'taskSubName', width: 600, editable: true},
        {name: 'content', index: 'content', width: 450, editable: true},
        {name: 'userName', index: 'userName', width: 100, editable: true},
        {name: 'createDate', index: 'createDate', width: 100, editable: true },
        {name : 'status', index:"status",width : 100, align : "center",formatter:statusFormatter}
    ];


    /**
     * 任务状态格式化
     */
    function statusFormatter(data) {
        switch(data) {
            case '0':
                return '未读';
                break;
            case '1':
                return '已读';
                break;;
            default:
                return '未知';
        }
    }


    // jqgrid的具体执行方法
    var rowIds;
    var userList;
    jqgrid({
        gridTableId: "#gridTable",
        gridPagerId: "#gridPager",
        postData:{'taskMainId':$('#taskMainId').html().trim()},
        autoScroll: false,
        shrinkToFit: false,
        multiselect:false,
        rownumbers: true,
        onSelectRow: function (rowid, status) {
            rowIds = rowid
            //选择当前的行
            rowids = rowid
            var selectedRowValue = $("#gridTable").jqGrid('getRowData', rowid);
            var types = selectedRowValue.type;//获取任务状态
            //只有已经反馈和待反馈才可以打开
        },
        loadComplete:function (data) {
            console.log(data);
            var ids = $("#gridTable").jqGrid("getDataIDs");
            console.log(ids);
            var rowDatas = $("#gridTable").jqGrid("getRowData");//获取所有行的数据
            for (var i = 0; i<rowDatas.length;i++){
                if (data.rows[i].type == 2){
                    $("#"+ids[i]+ " td").css("background","yellow"); //已反馈
                }
            }
        },
    });

</script>

</body>
</html>